| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | Static Public Member Functions | List of all members
nkAstraeus::AtmosphereEffect Class Referencefinal

An atmosphere effect. More...

Inheritance diagram for nkAstraeus::AtmosphereEffect:

## Public Member Functions
| AtmosphereEffect (System *system) noexcept
virtual | ~AtmosphereEffect ()
nkGraphics::Texture * | getSunTransmittanceLut () const
nkGraphics::Texture * | getMultiScatteringLut () const
nkGraphics::Texture * | getSourceColorTexture () const
nkGraphics::Texture * | getSourceDepthTexture () const
nkGraphics::Shader * | getLutShader () const
nkMaths::Vector | getSunPosition () const
nkMaths::Vector | getPlanetAlbedo () const
nkMaths::Vector | getRayleighScattering () const
nkMaths::Vector | getRayleighExtinction () const
nkMaths::Vector | getRayleighAbsorb () const
nkMaths::Vector | getMieScattering () const
nkMaths::Vector | getMieExtinction () const
nkMaths::Vector | getMieAbsorb () const
nkMaths::Vector | getOzoneScattering () const
nkMaths::Vector | getOzoneExtinction () const
nkMaths::Vector | getOzoneAbsorb () const
float | getMieG () const
float | getRayleighHeightDensityFactor () const
float | getMieHeightDensityFactor () const
float | getOzoneHeightDensityFactor () const
float | getDistanceFactor () const
float | getSunIlluminanceFactor () const
float | getSunAngularRadius () const
unsigned int | getSunLutSampleCount () const
unsigned int | getMultiScatteringLutSphereSampleCount () const
unsigned int | getMultiScatteringLutMarchSampleCount () const
unsigned int | getRaymarchSampleCount () const
unsigned int | getSunTransmittanceLutWidth () const
unsigned int | getSunTransmittanceLutHeight () const
unsigned int | getMultiScatteringLutWidth () const
unsigned int | getMultiScatteringLutHeight () const
SHADOW_MAP_PCF | getShadowSamplingMethod () const
float | getShadowDepthBias () const
bool | getShadowDebug () const
bool | getUseHalfFloatForLuts () const
bool | getOnlyScatterOnObjects () const
bool | getDisplaySun () const
bool | getReverseZ () const
void | setSourceColorTexture (nkGraphics::Texture *value)
void | setSourceDepthTexture (nkGraphics::Texture *value)
void | setSunPosition (nkMaths::Vector value)
void | setPlanetAlbedo (nkMaths::Vector value)
void | setRayleighScattering (nkMaths::Vector value)
void | setRayleighExtinction (nkMaths::Vector value)
void | setRayleighAbsorb (nkMaths::Vector value)
void | setMieScattering (nkMaths::Vector value)
void | setMieExtinction (nkMaths::Vector value)
void | setMieAbsorb (nkMaths::Vector value)
void | setOzoneScattering (nkMaths::Vector value)
void | setOzoneExtinction (nkMaths::Vector value)
void | setOzoneAbsorb (nkMaths::Vector value)
void | setMieG (float value)
void | setRayleighHeightDensityFactor (float value)
void | setMieHeightDensityFactor (float value)
void | setOzoneHeightDensityFactor (float value)
void | setDistanceFactor (float value)
void | setSunIlluminanceFactor (float value)
void | setSunAngularRadius (float value)
void | setSunTransmittanceLutSampleCount (unsigned int value)
void | setMultiScatteringLutSphereSampleCount (unsigned int value)
void | setMultiScatteringLutMarchSampleCount (unsigned int value)
void | setRaymarchSampleCount (unsigned int value)
void | setShadowSource (nkGraphics::Texture *shadowMap, nkGraphics::Camera *lightCamera)
void | setShadowSamplingMethod (SHADOW_MAP_PCF value)
void | setShadowDepthBias (float value)
void | setShadowDebug (bool value)
void | setSunTransmittanceLutWidth (unsigned int value)
void | setSunTransmittanceLutHeight (unsigned int value)
void | setMultiScatteringLutWidth (unsigned int value)
void | setMultiScatteringLutHeight (unsigned int value)
void | setUseHalfFloatForLuts (bool value)
void | setOnlyScatterOnObjects (bool value)
void | setDisplaySun (bool value)
void | setReverseZ (bool value)
void | setDebugNumericalInstability (bool value)
bool | refreshLuts ()
virtual bool | load () override
virtual void | unload () override
Public Member Functions inherited from nkAstraeus::Effect
| Effect (EFFECT_TYPE type) noexcept
virtual | ~Effect ()
nkMemory::StringView | getName () const
nkGraphics::Shader * | getShader () const
EFFECT_TYPE | getType () const
void | setName (nkMemory::StringView value)

## Static Public Member Functions
static nkMemory::UniquePtr< AtmosphereEffect > | create (System *system=nullptr)

## Detailed Description

An atmosphere effect.

This effect imitates the atmosphere and the way it interacts with light. This allows to create a plausible, dynamic sky. The effect also packs a light scattering logic, allowing to simulate the atmosphere impact on distant objects. While it defaults to a reality-like rendering, the numerous parameters also ensure it is possible to be creative with the effect.
This effect is heavily based on various papers, that can help getting a good understanding of how the effect works :

- The Frostbite paper.
- The UnrealEngine paper.

Note that this effect focuses (for now) on painting the atmosphere as seen from inside of it, not outside. As such, it is not possible to simulate the atmosphere as seen from a planet far away.

## Constructor & Destructor Documentation

## ◆ AtmosphereEffect()

nkAstraeus::AtmosphereEffect::AtmosphereEffect | ( | System * | system | ) |
| noexcept

Default constructor. Alternatively, see AtmosphereEffect::create(), or EffectManager::createOrRetrieve().

## ◆ ~AtmosphereEffect()

virtual nkAstraeus::AtmosphereEffect::~AtmosphereEffect | ( |  | ) |
| virtual

Destructor. See EffectManager::erase().

## Member Function Documentation

## ◆ getSunTransmittanceLut()

nkGraphics::Texture* nkAstraeus::AtmosphereEffect::getSunTransmittanceLut | ( |  | ) | const

Returns
  The sun transmittance generated Look-Up-Table texture.

## ◆ getMultiScatteringLut()

nkGraphics::Texture* nkAstraeus::AtmosphereEffect::getMultiScatteringLut | ( |  | ) | const

Returns
  The multi scattering generated Look-Up-Table texture.

## ◆ getSourceColorTexture()

nkGraphics::Texture* nkAstraeus::AtmosphereEffect::getSourceColorTexture | ( |  | ) | const

Returns
  The currently used source color texture.

## ◆ getSourceDepthTexture()

nkGraphics::Texture* nkAstraeus::AtmosphereEffect::getSourceDepthTexture | ( |  | ) | const

Returns
  The curently used source depth texture.

## ◆ getLutShader()

nkGraphics::Shader* nkAstraeus::AtmosphereEffect::getLutShader | ( |  | ) | const

Returns
  The shader used internally to generate the LUTs.

## ◆ getSunPosition()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getSunPosition | ( |  | ) | const

Returns
  The currently set sun position.

## ◆ getPlanetAlbedo()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getPlanetAlbedo | ( |  | ) | const

Returns
  The currently set planet albedo.

## ◆ getRayleighScattering()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getRayleighScattering | ( |  | ) | const

Returns
  The currently set Rayleigh scattering.

## ◆ getRayleighExtinction()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getRayleighExtinction | ( |  | ) | const

Returns
  The currently set Rayleigh extinction.

## ◆ getRayleighAbsorb()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getRayleighAbsorb | ( |  | ) | const

Returns
  The currently set Rayleigh absorption.

## ◆ getMieScattering()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getMieScattering | ( |  | ) | const

Returns
  The currently set Mie scattering.

## ◆ getMieExtinction()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getMieExtinction | ( |  | ) | const

Returns
  The currently set Mie extinction.

## ◆ getMieAbsorb()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getMieAbsorb | ( |  | ) | const

Returns
  The currently set Mie absorption.

## ◆ getOzoneScattering()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getOzoneScattering | ( |  | ) | const

Returns
  The currently set ozone scattering.

## ◆ getOzoneExtinction()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getOzoneExtinction | ( |  | ) | const

Returns
  The currently set ozone extinction.

## ◆ getOzoneAbsorb()

nkMaths::Vector nkAstraeus::AtmosphereEffect::getOzoneAbsorb | ( |  | ) | const

Returns
  The currently set ozone absorption.

## ◆ getMieG()

float nkAstraeus::AtmosphereEffect::getMieG | ( |  | ) | const

Returns
  The currently set Mie g parameter.

## ◆ getRayleighHeightDensityFactor()

float nkAstraeus::AtmosphereEffect::getRayleighHeightDensityFactor | ( |  | ) | const

Returns
  The currently set Rayleigh height density factor.

## ◆ getMieHeightDensityFactor()

float nkAstraeus::AtmosphereEffect::getMieHeightDensityFactor | ( |  | ) | const

Returns
  The currently set Mie height density factor.

## ◆ getOzoneHeightDensityFactor()

float nkAstraeus::AtmosphereEffect::getOzoneHeightDensityFactor | ( |  | ) | const

Returns
  The currently set ozone height density factor.

## ◆ getDistanceFactor()

float nkAstraeus::AtmosphereEffect::getDistanceFactor | ( |  | ) | const

Returns
  The currently set distance multiplying factor.

## ◆ getSunIlluminanceFactor()

float nkAstraeus::AtmosphereEffect::getSunIlluminanceFactor | ( |  | ) | const

Returns
  The currently set sun illuminance factor.

## ◆ getSunAngularRadius()

float nkAstraeus::AtmosphereEffect::getSunAngularRadius | ( |  | ) | const

Returns
  The currently set sun angular radius.

## ◆ getSunLutSampleCount()

unsigned int nkAstraeus::AtmosphereEffect::getSunLutSampleCount | ( |  | ) | const

Returns
  The currently set sun transmittance LUT generation sampling count.

## ◆ getMultiScatteringLutSphereSampleCount()

unsigned int nkAstraeus::AtmosphereEffect::getMultiScatteringLutSphereSampleCount | ( |  | ) | const

Returns
  The currently set multi scattering LUT generation sphere sampling count.

## ◆ getMultiScatteringLutMarchSampleCount()

unsigned int nkAstraeus::AtmosphereEffect::getMultiScatteringLutMarchSampleCount | ( |  | ) | const

Returns
  The currently set multi scattering LUT generation marching sampling count.

## ◆ getRaymarchSampleCount()

unsigned int nkAstraeus::AtmosphereEffect::getRaymarchSampleCount | ( |  | ) | const

Returns
  The currently set raymarching sample count, during rendering.

## ◆ getSunTransmittanceLutWidth()

unsigned int nkAstraeus::AtmosphereEffect::getSunTransmittanceLutWidth | ( |  | ) | const

Returns
  The currently set sun transmittance LUT width.

Remarks
  The returned value will reflect the actual settings, not the current LUT size. This can create a mismatch if the refreshLut() method has not been called after the setting has been set.

## ◆ getSunTransmittanceLutHeight()

unsigned int nkAstraeus::AtmosphereEffect::getSunTransmittanceLutHeight | ( |  | ) | const

Returns
  The currently set sun transmittance LUT height.

Remarks
  The returned value will reflect the actual settings, not the current LUT size. This can create a mismatch if the refreshLut() method has not been called after the setting has been set.

## ◆ getMultiScatteringLutWidth()

unsigned int nkAstraeus::AtmosphereEffect::getMultiScatteringLutWidth | ( |  | ) | const

Returns
  The currently set multi scattering LUT width.

Remarks
  The returned value will reflect the actual settings, not the current LUT size. This can create a mismatch if the refreshLut() method has not been called after the setting has been set.

## ◆ getMultiScatteringLutHeight()

unsigned int nkAstraeus::AtmosphereEffect::getMultiScatteringLutHeight | ( |  | ) | const

Returns
  The currently set multi scattering LUT height.

Remarks
  The returned value will reflect the actual settings, not the current LUT size. This can create a mismatch if the refreshLut() method has not been called after the setting has been set.

## ◆ getShadowSamplingMethod()

SHADOW_MAP_PCF nkAstraeus::AtmosphereEffect::getShadowSamplingMethod | ( |  | ) | const

Returns
  The currently set shadow sampling method, for the visibility function.

## ◆ getShadowDepthBias()

float nkAstraeus::AtmosphereEffect::getShadowDepthBias | ( |  | ) | const

Returns
  The currently set shadow depth bias, for the visibility function.

## ◆ getShadowDebug()

bool nkAstraeus::AtmosphereEffect::getShadowDebug | ( |  | ) | const

Returns
  Whether the visibility function's shadow out of bounds debugging flag is on (true) or off (false).

## ◆ getUseHalfFloatForLuts()

bool nkAstraeus::AtmosphereEffect::getUseHalfFloatForLuts | ( |  | ) | const

Returns
  Whether the LUTs will use half floats to store the data (true) or not (false).

Remarks
  The returned value will reflect the actual settings, not the current LUT format. This can create a mismatch if the refreshLut() method has not been called after the setting has been set.

## ◆ getOnlyScatterOnObjects()

bool nkAstraeus::AtmosphereEffect::getOnlyScatterOnObjects | ( |  | ) | const

Returns
  Whether the effect will only scatter on visible objects (true) or not (false).

## ◆ getDisplaySun()

bool nkAstraeus::AtmosphereEffect::getDisplaySun | ( |  | ) | const

Returns
  Whether the effect will also display the sun during rendering (true) or not (false).

## ◆ getReverseZ()

bool nkAstraeus::AtmosphereEffect::getReverseZ | ( |  | ) | const

Returns
  Whether the effect is setup to account for reversed Z values (true) or standard Z values (false).

## ◆ setSourceColorTexture()

void nkAstraeus::AtmosphereEffect::setSourceColorTexture | ( | nkGraphics::Texture * | value | ) |

Sets the source color texture to use to render the effect. The source color corresponds to the active color buffer, and will be interpreted as the incoming light from surrounding objects. Typically, the effect expects a black background to paint the sky. Any non black pixel will be taken as input and the light scattering along the way will be applied on it. To ensure the best rendering, it is expected to get a light buffer (float texture) to physically simulate the scattering on.

Parameters

  value | The source color (light) texture to use.

## ◆ setSourceDepthTexture()

void nkAstraeus::AtmosphereEffect::setSourceDepthTexture | ( | nkGraphics::Texture * | value | ) |

Sets the source depth texture to use to render the effect. The depth information is expected as non linear, as rendered normally. This information is used to casts the rays to march, to scatter the light along. The typical texture to provide is the depth buffer of the active scene rendering, for which the atmosphere effect should be applied.

Parameters

  value | The texture to use for depth sampling.

## ◆ setSunPosition()

void nkAstraeus::AtmosphereEffect::setSunPosition | ( | nkMaths::Vector | value | ) |

Sets the sun position to use for rendering. The sun position is normalized to ultimately be used as a direction from which the sun light is coming from. As such, the position can be thought as a position on the unit circle around the camera, in the world coordinates.
Defaults to the full zenith (0, 1, 0).

Parameters

  value | The wanted sun position, in world coordinates.

## ◆ setPlanetAlbedo()

void nkAstraeus::AtmosphereEffect::setPlanetAlbedo | ( | nkMaths::Vector | value | ) |

Sets the planet general albedo, which can be interpreted as the ambient light.
Defaults to a low, dark (0.1, 0.1, 0.1).

Parameters

  value | The planet albedo to use.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setRayleighScattering()

void nkAstraeus::AtmosphereEffect::setRayleighScattering | ( | nkMaths::Vector | value | ) |

Sets the Rayleigh scattering value to use. The value is expected to be per meters. The Rayleigh component corresponds to the light interaction with the atmosphere molecules, in this context how they scatter the light over the distance.
Defaults to a realistic looking (5.802, 13.558, 33.1).

Parameters

  value | The scattering to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setRayleighExtinction()

void nkAstraeus::AtmosphereEffect::setRayleighExtinction | ( | nkMaths::Vector | value | ) |

Sets the Rayleigh extinction value to use. The value is expected to be per meters. The Rayleigh component corresponds to the light interaction with the atmosphere molecules, in this context how they extinct the light over the distance.
Defaults to a realistic looking (5.802, 13.558, 33.1).

Parameters

  value | The extinction to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setRayleighAbsorb()

void nkAstraeus::AtmosphereEffect::setRayleighAbsorb | ( | nkMaths::Vector | value | ) |

Sets the Rayleigh absorb value to use. The value is expected to be per meters. The Rayleigh component corresponds to the light interaction with the atmosphere molecules, in this context how they absorb the light over the distance.
Defaults to a realistic looking (0, 0, 0).

Parameters

  value | The absorption to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMieScattering()

void nkAstraeus::AtmosphereEffect::setMieScattering | ( | nkMaths::Vector | value | ) |

Sets the Mie scattering value to use. The value is expected to be per meters. The Mie component corresponds to the light interaction with the atmosphere particles, in this context how they scatter the light over the distance.
Defaults to a realistic looking (3.996, 3.996, 3.996).

Parameters

  value | The scattering to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMieExtinction()

void nkAstraeus::AtmosphereEffect::setMieExtinction | ( | nkMaths::Vector | value | ) |

Sets the Mie extinction value to use. The value is expected to be per meters. The Mie component corresponds to the light interaction with the atmosphere particles, in this context how they extinct the light over the distance.
Defaults to a realistic looking (8.396, 8.396, 8.396).

Parameters

  value | The extinction to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMieAbsorb()

void nkAstraeus::AtmosphereEffect::setMieAbsorb | ( | nkMaths::Vector | value | ) |

Sets the Mie absorption value to use. The value is expected to be per meters. The Mie component corresponds to the light interaction with the atmosphere particles, in this context how they absorb the light over the distance.
Defaults to a realistic looking (4.4, 4.4, 4.4).

Parameters

  value | The absorption to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setOzoneScattering()

void nkAstraeus::AtmosphereEffect::setOzoneScattering | ( | nkMaths::Vector | value | ) |

Sets the ozone scattering value to use. The value is expected to be per meters. The ozone component corresponds to the light interaction with the gas, in this context how it scatters the light over the distance.
Defaults to a realistic looking (0, 0, 0).

Parameters

  value | The scattering to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setOzoneExtinction()

void nkAstraeus::AtmosphereEffect::setOzoneExtinction | ( | nkMaths::Vector | value | ) |

Sets the ozone extinction value to use. The value is expected to be per meters. The ozone component corresponds to the light interaction with the gas, in this context how it extincts the light over the distance.
Defaults to a realistic looking (0.65, 1.881, 0.085).

Parameters

  value | The extinction to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setOzoneAbsorb()

void nkAstraeus::AtmosphereEffect::setOzoneAbsorb | ( | nkMaths::Vector | value | ) |

Sets the ozone absorption value to use. The value is expected to be per meters. The ozone component corresponds to the light interaction with the gas, in this context how it absorbs the light over the distance.
Defaults to a realistic looking (0.65, 1.881, 0.085).

Parameters

  value | The absorption to use (R, G, B).

Remarks
  While the scattering, extinction and absorption are given as implicitly linked in a realistic context, they have been decoupled in this effect for creative purposes.
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMieG()

void nkAstraeus::AtmosphereEffect::setMieG | ( | float | value | ) |

Sets the Mie g parameter's value. The parameter is part of its phase equation, and can be interpreted as the amount of influence the particle have. Realistic values range between ]0, 1[, with a higher value cranking up the effect.
Defaults to a realistic looking value of 0.8.

Parameters

  value | The value to set for the parameter.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setRayleighHeightDensityFactor()

void nkAstraeus::AtmosphereEffect::setRayleighHeightDensityFactor | ( | float | value | ) |

Sets the height density factor for the Rayleigh influence. The atmosphere having a different composition as altitude changes, it impacts differently the light traveling through it depending on its height. This parameter allows to make it more or less dense at lower altitude. The lower the value, the higher the density.
Defaults to 1.

Parameters

  value | The factor to use.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMieHeightDensityFactor()

void nkAstraeus::AtmosphereEffect::setMieHeightDensityFactor | ( | float | value | ) |

Sets the height density factor for the Mie influence. The atmosphere having a different composition as altitude changes, it impacts differently the light traveling through it depending on its height. This parameter allows to make it more or less dense at lower altitude. The lower the value, the higher the density.
Defaults to 1.

Parameters

  value | The factor to use.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setOzoneHeightDensityFactor()

void nkAstraeus::AtmosphereEffect::setOzoneHeightDensityFactor | ( | float | value | ) |

Sets the height density factor for the ozone influence. The atmosphere having a different composition as altitude changes, it impacts differently the light traveling through it depending on its height. This parameter allows to make it more or less dense at lower altitude. The lower the value, the higher the density.
Defaults to 1.

Parameters

  value | The factor to use.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setDistanceFactor()

void nkAstraeus::AtmosphereEffect::setDistanceFactor | ( | float | value | ) |

Sets the distance factor, to apply to computed distances found. This parameter is a direct factor applied to the raymarching distance, impacting how deep a ray will travel in the atmosphre. It is applied to the distance found from the source depth texture, and the intersection with the planet's surface.
Defaults to 1.

Parameters

  value | The factor to use.

## ◆ setSunIlluminanceFactor()

void nkAstraeus::AtmosphereEffect::setSunIlluminanceFactor | ( | float | value | ) |

Sets the sun illuminance factor, impacting how bright the sun should be considered. This will make the whole atmosphere brighter or darker depending on the setting.
The effect works within [0, 1], so by changing this parameter it becomes possible to scale the output brightness to your own light units.
Defaults to 5, for an increased brightness on simple rendering pipelines.

Parameters

  value | The factor to use.

## ◆ setSunAngularRadius()

void nkAstraeus::AtmosphereEffect::setSunAngularRadius | ( | float | value | ) |

Sets the sun angular radius, in degrees. This drives how big the sun will be as seen in the sky.
Defaults to a realistic looking 0.545.

Parameters

  value | The angular radius, in degrees.

## ◆ setSunTransmittanceLutSampleCount()

void nkAstraeus::AtmosphereEffect::setSunTransmittanceLutSampleCount | ( | unsigned int | value | ) |

Sets the sample count when computing the sun transmittance LUT. The higher the sample count, the higher the quality, but also higher the impact on performances.
Defaults to 40.

Parameters

  value | The number of samples that should be taken during LUT creation.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMultiScatteringLutSphereSampleCount()

void nkAstraeus::AtmosphereEffect::setMultiScatteringLutSphereSampleCount | ( | unsigned int | value | ) |

Sets the sample count taken during sphere sampling (around a given point) when computing the multi scattering LUT. The sampling is done along 2 directions, giving a total sample count of the value given squared. The higher the sample count, the higher the quality, but also higher the impact on performances.
Defaults to 8.

Parameters

  value | The number of samples that should be taken during LUT creation.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMultiScatteringLutMarchSampleCount()

void nkAstraeus::AtmosphereEffect::setMultiScatteringLutMarchSampleCount | ( | unsigned int | value | ) |

Sets the sample count taken during marching when computing the multi scattering LUT. The higher the sample count, the higher the quality, but also higher the impact on performances.
Defaults to 20.

Parameters

  value | The number of samples that should be taken during LUT creation.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setRaymarchSampleCount()

void nkAstraeus::AtmosphereEffect::setRaymarchSampleCount | ( | unsigned int | value | ) |

Sets the sample count taken during marching when rendering the effect The higher the sample count, the higher the quality, but also higher the impact on performances.
Defaults to 32.

Parameters

  value | The number of samples that should be taken during LUT creation.

Remarks
  Changing this parameter requires a reload, if the effect is already loaded.

## ◆ setShadowSource()

void nkAstraeus::AtmosphereEffect::setShadowSource | ( | nkGraphics::Texture * | shadowMap,
|  | nkGraphics::Camera * | lightCamera
| ) |  |

Sets the shadow mapping resources to use for the visibility method during sampling of the light scattering. This directly links it to the ShadowMappingLib::nkShadowMap() sources.
If left unset, the visibility method always returns 1.

Parameters

  shadowMap | The texture to use as the shadow map.
  lightCamera | The camera from which the shadow map has been generated.

Remarks
  Changing this parameter requires a reload, if the effect was already loaded with this parameter off. Dynamically updating the parameters if they were already used is possible.

## ◆ setShadowSamplingMethod()

void nkAstraeus::AtmosphereEffect::setShadowSamplingMethod | ( | SHADOW_MAP_PCF | value | ) |

Sets the shadow map sampling method for the visibility method. This directly links to the dedicated flag within the ShadowMappingLib::nkShadowMap() sources.
The default value is the one used by default by ShadowMappingLib::nkShadowMap().

Parameters

  value | The sampling method to use.

Remarks
  Changing this parameter requires a reload, if the effect is already loaded.

## ◆ setShadowDepthBias()

void nkAstraeus::AtmosphereEffect::setShadowDepthBias | ( | float | value | ) |

Sets the shadow mapping depth bias, for the visibility method. This directly links to the dedicated flag within the ShadowMappingLib::nkShadowMap() sources.

Parameters

  value | The bias to use.

Remarks
  Changing this parameter requires a reload, if the effect is already loaded.

## ◆ setShadowDebug()

void nkAstraeus::AtmosphereEffect::setShadowDebug | ( | bool | value | ) |

Sets whether the shadow mapping out of bounds debugging capabilities should be enabled or not. This directly links to the dedicated flag within the ShadowMappingLib::nkShadowMap() sources.

Parameters

  value | Whether the enable the flag (true) or not (false).

Remarks
  Changing this parameter requires a reload, if the effect is already loaded.

## ◆ setSunTransmittanceLutWidth()

void nkAstraeus::AtmosphereEffect::setSunTransmittanceLutWidth | ( | unsigned int | value | ) |

Sets the target width for the sun transmittance LUT.
Defaults to 256.

Parameters

  value | The dimension wanted, in pixels.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setSunTransmittanceLutHeight()

void nkAstraeus::AtmosphereEffect::setSunTransmittanceLutHeight | ( | unsigned int | value | ) |

Sets the target height for the sun transmittance LUT.
Defaults to 64.

Parameters

  value | The dimension wanted, in pixels.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMultiScatteringLutWidth()

void nkAstraeus::AtmosphereEffect::setMultiScatteringLutWidth | ( | unsigned int | value | ) |

Sets the target width for the multi scattering LUT.
Defaults to 64.

Parameters

  value | The dimension wanted, in pixels.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setMultiScatteringLutHeight()

void nkAstraeus::AtmosphereEffect::setMultiScatteringLutHeight | ( | unsigned int | value | ) |

Sets the target height for the multi scattering LUT.
Defaults to 64.

Parameters

  value | The dimension wanted, in pixels.

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setUseHalfFloatForLuts()

void nkAstraeus::AtmosphereEffect::setUseHalfFloatForLuts | ( | bool | value | ) |

Sets whether the LUTs generated should use half floats instead of pure floats. This can save memory and bandwith, potentially helping with performances at the price of less accurate LUTs. Default is false (off, pure floats).

Parameters

  value | Whether the LUTs should be hald floats (true) or not (false).

Remarks
  Changing this parameter requires to call refreshLuts(), if the effect is already loaded.

## ◆ setOnlyScatterOnObjects()

void nkAstraeus::AtmosphereEffect::setOnlyScatterOnObjects | ( | bool | value | ) |

Sets whether the effect will only scatter on visible object, or not. When this option is activated, the depth value will be filtered and all values equal to 1 won't be rendered. This prevents the effect from rendering the far sky.
Defaults to false.

Parameters

  value | Whether the effect should only scatter on visible object (true), or not (false).

Remarks
  Changing this parameter requires to reload the effect.

## ◆ setDisplaySun()

void nkAstraeus::AtmosphereEffect::setDisplaySun | ( | bool | value | ) |

Sets whether the effect will display the sun, or not. This can be useful to disable the sun during environment map rendering, and display it when rendering it on screen.
Defaults to true.

Parameters

  value | Whether the effect should display the sun (true) or not (false).

Remarks
  Changing this parameter requires to reload the effect.

## ◆ setReverseZ()

void nkAstraeus::AtmosphereEffect::setReverseZ | ( | bool | value | ) |

Sets whether the effect should account for reversed Z values or not. This should be on if the effect is used during a pass with a reversed Z projection camera, off else. Defaults to true.

Parameters

  value | Whether the Z values should be expected reversed (true) or not (false).

Remarks
  Changing this parameter requires to reload the effect.

## ◆ setDebugNumericalInstability()

void nkAstraeus::AtmosphereEffect::setDebugNumericalInstability | ( | bool | value | ) |

Sets whether the potential numerical instabilities, due to precision or overflow, should be displayed for debugging purposes. The offending pixels will be painted bright red (1, 0, 0). This is mainly used for testing and debugging in case the rendering gets weird or corrupts environment maps. Default to false.

Parameters

  value | Whether the feature should be enabled (true) or not (false).

Remarks
  Changing this parameter requires to reload the effect.

## ◆ refreshLuts()

bool nkAstraeus::AtmosphereEffect::refreshLuts | ( |  | ) |

Manually refreshes the Look-Up-Table textures. Calling this method might be necessary depending on which parameter has been changed while the effect was loaded. Else, the LUTs are generated during the effect loading, for given parameters at the time.

Returns
  Whether the textures have been properly updated (true) or not (false).

## ◆ load()

virtual bool nkAstraeus::AtmosphereEffect::load | ( |  | ) |
| override virtual

Loads the effect and make it ready for rendering.

Returns
  Whether the loading went well (true) or not (false).

Implements nkAstraeus::Effect.

## ◆ unload()

virtual void nkAstraeus::AtmosphereEffect::unload | ( |  | ) |
| override virtual

Unloads the effect and its internal memory. After that, the effect is unusable for rendering.

Implements nkAstraeus::Effect.

## ◆ create()

static nkMemory::UniquePtr<AtmosphereEffect> nkAstraeus::AtmosphereEffect::create | ( | System * | system = `nullptr` | ) |
| static

Creates an instance of the class, and returns ownership over it.

Parameters

  system | The system the resource should live in. If left to nullptr, will seek the singleton instance of the system.

Returns
  Ownership over the created instance of the class.

Remarks
  The instance is not part of any manager if instantiated this way. If the resource's lifetime should be managed within the manager, then calling ComplexEffectManager::createOrRetrieve() might be a better option. Alternatively, registering it afterwards through ComplexEffectManager::record() is another option.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsAstraeus/Graphics/Effects/Atmosphere/AtmosphereEffect.h